#!/bin/bash

# init global quota env
if [ -z ${QUOTA_SOURCE_FILE} ]; then
    echo "=====检查配额验证环境===== not pass : need source /root/quota_test/0_source_env.sh"
    exit 1
fi
echo -e "\t1.初始化全局环境白能量"

if [ ! -d ${QUOTA_BASE_DIR} ]; then
    echo "=====检查配额验证环境===== not pass : ${QUOTA_BASE_DIR} is not exist, create it"
    mkdir -p ${QUOTA_BASE_DIR}
    orcafs-ctl --setpattern --storagepoolid=2 ${QUOTA_BASE_DIR}
    #exit 1
fi
echo -e "\t2.创建 ${QUOTA_BASE_DIR}"

if ! id u1 &> /dev/null; then useradd -s /bin/bash -U -m u1; fi
if ! id u2 &> /dev/null; then useradd -s /bin/bash -U -m u2; fi
if ! id u3 &> /dev/null; then useradd -s /bin/bash -U -m u3; fi
echo -e "\t3.创建系统用户 u1 u2 u3"
echo "=====检查配额验证环境===== pass"